package com.zkzx.company.api.service.sitemail;

import com.zkzx.common.constants.ServiceEnum;
import com.zkzx.common.constants.StatusEnum;
import com.zkzx.company.api.mapper.AnnouncementMapper;
import com.zkzx.company.api.mapper.entity.Announcement;
import com.zkzx.company.api.mapper.entity.AnnouncementExample;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author young Email:yanghui@zkraising.com
 * @description
 * @company 北京中科智兴物联科技有限公司 @版权所有
 * @since 2021年05月17日 14时29分
 */
@Slf4j
@Service
public class AnnouncementService {


    @Resource
    private AnnouncementMapper announcementMapper;

    /**
     * 获取公告信息
     * @return
     */
    public Announcement getByCompany(){
        AnnouncementExample announcementExample = new AnnouncementExample();
        announcementExample.createCriteria().andTypeEqualTo(ServiceEnum.COMPANY.name())
                .andStatusEqualTo(StatusEnum.ENABLE.name());
        return announcementMapper.selectByExample(announcementExample).stream().findFirst().orElse(null);
    }
}
